# -*- coding: utf-8 -*-
"""
@author: wyb
@date: 2023/12/4
@time: 21:10
@desc: QQ email test
"""

import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText

from_email = "49402612@qq.com"
password = "ndtmsyijvvtdbgdh"
to_email = "wdhwyb@hotmail.com"
msg = MIMEMultipart()
msg['From'] = from_email
msg['To'] = to_email
subject = "Test Email2"
content = "This is a test email sent from Python 3."
msg['Subject'] = subject

msg.attach(MIMEText(content, 'plain', 'utf-8'))

smt = smtplib.SMTP('smtp.qq.com', 587)
print(smt.ehlo())
print(smt.starttls())
pwd = input()
print((smt.login(from_email, pwd)))
txt = msg.as_string()
smt.sendmail(from_email, to_email, txt)
print(smt.quit())
